﻿using ServiceCore;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace Entity
{
    /// <summary>
    /// 卡管理
    /// </summary>
    public class rk_card
    {
        /// <summary>
        /// 卡ID 格式应该是card_no"-"rk_baseuserid
        /// </summary>
        public string card_id { get; set; }
        /// <summary>
        /// 卡号
        /// </summary>
        public string card_no { get; set; }
        /// <summary>
        ///  所属用户
        /// </summary>
        public string rk_baseuserid { get; set; }
        /// <summary>
        /// 用户uid  对应用户ID  可以对应两个系统内的不同数据
        /// </summary>
        public string uid { get; set; }
        /// <summary>
        ///  查询数据库
        /// </summary>
        public string search_db { get; set; }
        /// <summary>
        /// 查询表
        /// </summary>
        public string search_table { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime addtime { get; set; }
        /// <summary>
        /// 卡密码
        /// </summary>
        public string card_pwd { get; set; }
        /// <summary>
        /// 分类别名
        /// </summary>
        public string card_alias { get; set; }
        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime? expiration_time { get; set; }
        /// <summary>
        /// 卡状态
        /// </summary>
        public card_state card_state { get; set; }
        /// <summary>
        /// 激活时间
        /// </summary>
        public DateTime? activation_time { get; set; }
        /// <summary>
        /// 备注一
        /// </summary>
        public string remark_a { get; set; }
        /// <summary>
        /// 备注二
        /// </summary>
        public string remark_b { get; set; }

        /// <summary>
        /// 初始余额
        /// </summary>
        public decimal original_balance { get; set; }
        /// <summary>
        /// 当前可用余额
        /// </summary>
        public decimal? now_balance { get; set; }
        /// <summary>
        /// 添加人
        /// </summary>
        public string add_crm_uid { get; set; }

    }
    public enum card_state
    {

        未激活 = 0,
        已激活 = 1,
        已禁用 = 2,
        已过期 = 3
    }
    /// <summary>
    /// 卡记录列表
    /// </summary>
    public class rk_card_record
    {
        /// <summary>
        /// 卡记录ID
        /// </summary>
        public string card_record_id { get; set; }
        /// <summary>
        /// 卡ID
        /// </summary>
        public string card_id { get; set; }
        /// <summary>
        /// 卡号
        /// </summary>
        public string card_no { get; set; }
        /// <summary>
        /// 操作主体
        /// </summary>
        public string operation_subject { get; set; }
        /// <summary>
        /// 操作主体key
        /// </summary>
        public string operation_subject_key { get; set; }
        /// <summary>
        /// 操作日期
        /// </summary>
        public DateTime addtime { get; set; }
        /// <summary>
        /// 操作备注
        /// </summary>
        public string operation_remark { get; set; }
        /// <summary>
        /// 本次操作充值金额
        /// </summary>
        public decimal in_price { get; set; }
        /// <summary>
        /// 本次操作消费金额
        /// </summary>
        public decimal out_price { get; set; }
        /// <summary>
        /// 消费明细
        /// </summary>
        public string pay_details { get; set; }
        /// <summary>
        /// 记录类型
        /// </summary>
        public record_type record_type { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        public string order_no { get; set; }
        /// <summary>
        ///  操作前卡余额
        /// </summary>
        public decimal? before_price { get; set; }
        /// <summary>
        ///  所属商户
        /// </summary>
        public string rk_baseuserid { get; set; }
        /// <summary>
        /// 是否在机器上操作
        /// </summary>
        public bool is_mch { get; set; }
    }
    public enum record_type
    {
        开卡 = 0,
        充值 = 1,
        扣款 = 2,
    }

    #region 业务模型定义
    public class save_card_params
    {
         
        /// <summary>
        /// 卡号
        /// </summary>
        public List<card_item> card_nos { get; set; }
        /// <summary>
        /// 所属用户
        /// </summary>
        public string rk_baseuserid { get; set; }
    }

    public class card_item
    {
        /// <summary>
        /// 卡编号
        /// </summary>
        public string card_no { get; set; }
        /// <summary>
        /// 卡密码
        /// </summary>
        public string card_pwd { get; set; }
    }





    public class get_card_pagelist_params : Base_List_Params
    {
        /// <summary>
        /// 客户账号
        /// </summary>
        public string rk_login_name { get; set; }
        /// <summary>
        /// 卡号
        /// </summary>

        public string card_no { get; set; }

        public string rk_baseuserid { get; set; }
    }
    public class get_card_pagelist_item
    {
        /// <summary>
        /// 添加时间
        /// </summary>
        [Description("添加时间")]
        public DateTime addtime { get; set; }
        /// <summary>
        ///  客户账号
        /// </summary>
        [Description("客户账号")]
        public string rk_login_name { get; set; }
        /// <summary>
        /// 卡号
        /// </summary>
        [Description("卡号")]
        public string card_no { get; set; }
        /// <summary>
        /// 卡ID
        /// </summary>
        [Description("disable")]
        public string card_id { get; set; }
        /// <summary>
        /// 卡状态
        /// </summary>
        [Description("disable")]
        public card_state card_state { get; set; }

        /// <summary>
        /// 卡状态_chinese
        /// </summary>
        [Description("状态")]
        public string card_state_str { get { return card_state.ToString(); } } 
    }

    public class bacth_set_baseuserid_params
    {
        /// <summary>
        /// 修改卡列表
        /// </summary>
        public string[] card_ids { get; set; }
        /// <summary>
        /// 商户id
        /// </summary>
        public string rk_baseuserid { get; set; }
    }
    #endregion

    #region 
    public class card_search: Base_List_Params
    {
        /// <summary>
        /// 卡号
        /// </summary>
        public string card_no { get; set; }
        /// <summary>
        /// 卡状态
        /// </summary>
        public card_state? state { get; set; }
        /// <summary>
        /// 余额查询最小值 
        /// </summary>
        public decimal? min_balance { get; set; }
        /// <summary>
        /// 余额查询最大值
        /// </summary>
        public decimal? max_balance { get; set; }
        /// <summary>
        /// 开卡时间 开始时间
        /// </summary>
        public string activation_time_sdt { get; set; }
        /// <summary>
        /// 开卡时间 结束时间
        /// </summary>
        public string activation_time_edt { get; set; }
        /// <summary>
        /// 有效时间 开始时间
        /// </summary>
        public string expiration_time_sdt { get; set; }
        /// <summary>
        /// 有效时间 结束时间
        /// </summary>
        public string expiration_time_edt { get; set; }
        /// <summary>
        /// 持卡人
        /// </summary>
        public string remark_a { get; set; }
    }
    public class card_list_Item
    {
        [Description("开卡日期")]
        /// <summary>
        /// 开卡时间
        /// </summary>
        public DateTime? activation_time { get; set; }
        [Description("分类")]
        /// <summary>
        /// 分类别名
        /// </summary>
        public string card_alias { get; set; }
        [Description("卡号")]
        /// <summary>
        /// 卡号
        /// </summary>
        public string card_no { get; set; }
        [Description("有效截至日期")]
        /// <summary>
        ///  卡过期时间
        /// </summary>
        public DateTime? expiration_time { get; set; }
        [Description("余额")]
        /// <summary>
        /// 卡当前余额
        /// </summary>
        public decimal? now_balance { get; set; }
        [Description("状态")]
        /// <summary>
        /// 卡状态文字说明
        /// </summary>
        public string card_state_str { get { return this.card_state.ToString(); } }
        [Description("备注1")]
        /// <summary>
        /// 备注1 
        /// </summary>
        public string remark_a { get; set; }
        [Description("备注2")]
        /// <summary>
        /// 备注2 
        /// </summary>
        public string remark_b { get; set; } 
        [Description("disable")]
        /// <summary>
        /// 卡ID
        /// </summary>
        public string card_id { get; set; }
        [Description("disable")]
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime addtime { get; set; }
        [Description("disable")]
        /// <summary>
        /// 卡状态
        /// </summary>
        public card_state card_state { get; set; }
        [Description("disable")]
        /// <summary>
        /// 卡卡时设置的原始余额
        /// </summary>
        public decimal? original_balance { get; set; }
    }
    public class activation_Params
    {
        /// <summary>
        /// 卡号
        /// </summary>
        public string card_no { get; set; }
        /// <summary>
        ///  原始充值金额
        /// </summary>
        public decimal? original_balance { get; set; }
        /// <summary>
        /// 分类别名
        /// </summary>
        public string card_alias { get; set; }
        /// <summary>
        /// 有效截止日期
        /// </summary>
        public DateTime? expiration_time { get; set; }
        /// <summary>
        /// 卡状态
        /// </summary>
        public card_state? card_state { get; set; }
        /// <summary>
        /// 备注1 
        /// </summary>
        public string remark_a { get; set; }
        /// <summary>
        /// 备注2
        /// </summary>
        public string remark_b { get; set; }
    }

    public class edit_card_Params : activation_Params
    {
        /// <summary>
        /// 卡ID
        /// </summary>
        public string card_id { get; set; }
    }

    public class batch_change_params
    {
        /// <summary>
        /// 选中卡信息
        /// </summary>
        public string[] card_ids { get; set; }
        /// <summary>
        /// 卡状态
        /// </summary>
        public card_state? card_state { get; set; }

    }
    #endregion
    #region 卡消费记录
    public class card_record_search: Base_List_Params
    {
        /// <summary>
        /// 订单编号
        /// </summary>
        public string order_no { get; set; }
        /// <summary>
        /// 卡号
        /// </summary>
        public string card_no { get; set; }
        /// <summary>
        /// 操作主体
        /// </summary>
        public string operation_subject { get; set; }
        /// <summary>
        /// 充值记录类型
        /// </summary>
        public record_type? record_type { get; set; }
        /// <summary>
        ///  查询开始时间
        /// </summary>
        public string start_time { get; set; }
        /// <summary>
        /// 查询结束时间
        /// </summary>
        public string end_time { get; set; }
        /// <summary>
        /// 持卡人
        /// </summary>
        public string remark_a { get; set; }
    }

    public class card_record_Item
    {
        [Description("订单号")]
        public string order_no { get; set; }

        [Description("disable")]
        public record_type record_type { get; set; }
        [Description("操作")]
        public string record_type_str { get { return this.record_type.ToString(); } }
        [Description("操作设备")]
        public string operation_subject { get; set; }
        [Description("操作时间")]
        public DateTime addtime { get; set; }
        [Description("持卡人")]
        public string remark_a { get; set; }
        [Description("卡号")]
        public string card_no { get; set; }
        [Description("操作前卡余额")]
        public decimal? before_price { get; set; }
        [Description("充值金额")]
        public decimal? in_price { get; set; }
        [Description("扣款金额")]
        public decimal? out_price { get; set; }
        [Description("明细")]
        public string pay_details { get; set; }
        [Description("disable")]
        public string card_record_id { get; set; }
 
        [Description("disable")]
        public string remark_b { get; set; }
    }
    #endregion
}
